<?php
include "inc/database_functions.inc.php";

$bil_id = 1; //$_GET["billing_id"];
$query_billing = sprintf("SELECT *  FROM billing WHERE bil_id = %d", $bil_id);
$rs_billing = query($query_billing);
$bil_row = mysql_fetch_object($rs_billing);

$query_cart_item = sprintf("SELECT * FROM cart_item WHERE cart_id = %d", $bil_row->bil_cart);
$rs_cart_item = query($query_cart_item);

$item_array = array();

$billing_address = $bil_row->bil_address;
while ($cart_item_row = mysql_fetch_object($rs_cart_item)) {
  $item_array[] = array(
			"item_name" => $cart_item_row->item_name,
			"item_quantity" => $cart_item_row->item_quantity,
			"item_price" => $cart_item_row->item_price
			);
}
$billing_method = $bil_row->bil_method;
$total = 0;
$item_price = 0;
foreach ($item_array as $item) {
  $total += $item['item_quantity'] * $item['item_price'];
}
echo "\\\Billing Address: " . $billing_address;
echo "\\\Items: ";
foreach ($item_array as $item) {
  echo $item['item_quantity'] . '-' . $item['item_name'] . '-' . $item['item_price'] . ';';
}
echo "\\\Billing Method: " . $billing_method;
echo "\\\Total: " . $total;

disconnect();
?>